import { Injectable } from '@angular/core';
import {InterfaceProvider} from "@providers/interface";
import {PagingProvider} from "@providers/paging";

/*
  Generated class for the ConsigneeProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class ConsigneeProvider {

  constructor(private ifp: InterfaceProvider,
              private paging: PagingProvider,) {
    console.log('Hello ConsigneeProvider Provider');
  }


  /**
   * 确认提货信息
   * @param item ID:'',THYBM:'',THYMC:''
   * @returns {Promise<any>}
   */
  getLadingWait(item): Promise<any> {
    return this.ifp.post({
      interfaceId: "csm.som.cssOrder.makethyth",
      data: item || {}
    }).toPromise();
  }

  /**
   * 分页查询服务单
   * @param item {THYBM:'',THYMC:'',CS:''}CS=0表示已提货未装车 CS=1表示已提货已装车 CS=2表示待提货
   * @param pagingConfig 分页配置
   */
  getLadingFinish(item,pagingConfig): Promise<any> {
    return this.paging.get({
      interfaceId: "csm.som.cssOrder.selectThyth",
      data: item || {}
    },pagingConfig).toPromise();
  }

  /**
   * 确认待提货单据已提货
   * @param item ID:'',THYBM:'',THYMC:''
   * @returns {Promise<any>}
   */
  takeGoods(item):Promise<any>{
    return this.ifp.post({
      interfaceId:'csm.som.cssOrder.updateJDBJ',
      data:item||{}
    }).toPromise();
  }


}
